﻿using System;
using System.Windows.Forms;
using System.Data.SqlClient;
using SmartMarketTelas.localhost;


namespace SmartMarketTelas
{
    public partial class FormLogin : Form
    {



        Cliente cliente = new Cliente();
        public FormLogin()
        {
            InitializeComponent();
            textBox2.Text = "";
            textBox2.PasswordChar = '*';
        }
        public static string retornoTexto(string entrada)
        {
            return entrada.Split(new char[] { '\n' })[0].Split(new char[] { ':' })[2];
        }


        private void button1_Click(object sender, EventArgs e)
        {

            try
            {
                Cliente c = new Cliente();

                Service1 serv = new Service1();

                c.EMail = textBox1.Text;
                c.Rg = textBox2.Text;
                cliente = serv.EfetuarLogin(c);
                FormCompra fc = new FormCompra(cliente);  
                fc.ShowDialog();
                
                FormLogin fl = new FormLogin();
                fl.Hide();

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void FormLogin_Load(object sender, EventArgs e)
        {
        
       
            
        }

     
        private void button2_Click(object sender, EventArgs e)
        {
            Environment.Exit(0);
        }

        private void FormLogin_KeyPress(object sender, KeyPressEventArgs e)
        {
           
        }

        private void button3_Click(object sender, EventArgs e)
        {
            FormCadastrar fcad = new FormCadastrar();
            fcad.ShowDialog();
        }

        private void button2_Click_1(object sender, EventArgs e)
        {
            Environment.Exit(0);
        }

       
    }
}
